<!DOCTYPE html>
<html lang="zh-CN">
<html lang="zh-CN">
<html lang="en">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    
    .box {
        position: absolute;
        transition: 1s ease-in;
        background-color: rgb(250, 163, 163);
        width: 100%;
        height: 100%;
    }
    .nones{
        position: absolute;
        background-color: rgb(102, 188, 245);
        width: 100%;
        left: 100%;
        height: 100%;
        transition: 1s ease-in ;
    }
    .active{
        transition: 1s ease-in ;
        left: 50%;
    }
</style>

<body>
    <div id="app">
        <div class="box" >
            <button v-on:click="handler(idx)">点击</button>
        </div>
        <div class="nones" v-bind:class="active"></div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                idx: 0,
                active:''
            },
            methods: {
                handler(idx) {
                    this.idx = idx + 1
                this.active='active'
                    console.log(idx);
                    if (idx == 1) {
                        this.idx = 0
                        this.active=''
                    }
                }
            }
        })
    </script>
</body>

</html>